<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title th:text="${sectionName}">My Blog</title>
    <th:block th:replace="header::common_header" />
    <th:block th:replace="header::common_js" />
</head>
<div th:insert="~{nav :: nav}"></div>


<div class="container-fluid main">
    <div class="row">
        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
            <h2><span th:text="${sectionName}"></span></h2>
            <div class="media" th:each="question : ${pageList.getRecords()}">
                <div class="media-left">
                    <a th:href="@{'/question/'+${question.id}}">
                        <img class="media-object img-rounded" th:src="${question.user.avatarUrl}"
                             th:alt="${question.user.name}">
                    </a>
                </div>
                <div class="media-body">
                    <a th:href="@{'/question/'+${question.id}}">
                        <h4 class="media-heading" th:text="${question.title}"></h4>
                    </a>
                    <span th:text="${question.description}"></span>
                    <span class="span-desc">
                        <span th:text="${question.likeCount}"></span>人关注
                        <span th:text="${question.viewCount}"></span>次浏览
                        <span th:text="${#dates.format(question.getGmtCreate(),'yyyy/MM/dd')}"></span>发布
                    </span>
                </div>
            </div>
            <nav aria-label="..." th:if="${pageList.pages>0}">
                <ul class="pagination">
                    <li><a th:href="@{${jumpUrl}}"><span aria-hidden="true" th:text="首页"></span></a></li>
                    <li th:if="${pageList.current > 1}">
                        <a th:href="@{${jumpUrl} + ${pageList.current - 1}} " aria-label="Previous">
                            <span aria-hidden="true">&lt;</span>
                        </a>
                    </li>
                    <li th:each="i :${#numbers.sequence(1, pageList.pages)}"
                        th:class="${pageList.current == i} ? active : '' "><a th:href="@{${jumpUrl} + ${i}} "><span
                            aria-hidden="true" th:text="${i}"></span></a></li>
                    <li th:if="${pageList.current > 1 and pageList.current < pageList.getPages()}">
                        <a th:href="@{${jumpUrl} + ${pageList.current + 1}} " aria-label="Next">
                            <span aria-hidden="true">&gt;</span>
                        </a>
                    </li>
                    <li><a th:href="@{${jumpUrl} + ${pageList.getPages()}} "><span aria-hidden="true">最后一页</span></a>
                    </li>
                </ul>
            </nav>
        </div>
        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12 profile">
            <div class="list-group section">
                <a href="/profile/questions"
                   th:class="${section == 'questions'} ? 'list-group-item active' : 'list-group-item'">
                    我的问题
                </a>
                <a href="/profile/replies"
                   th:class="${section == 'replies'} ? 'list-group-item active' : 'list-group-item'"><span
                        class="badge">1</span>最新回复</a>
            </div>
        </div>
    </div>
</div>
</body>
</html>